/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package comboboxview;

import data.Departments;
import data.Sections;
import java.util.ArrayList;
import java.util.List;
import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;

/**
 *
 * @author Hùng
 */
public class SectionCbView extends AbstractListModel implements ComboBoxModel {

    List<Sections> lSec;
    Object selecttion = null;

    public SectionCbView() {
        new ArrayList<Sections>();
    }

    public SectionCbView(List<Sections> lSec) {
        this.lSec = lSec;
    }


    public Object getSelecttion() {
        return selecttion;
    }

    public void setSelecttion(Object selecttion) {
        this.selecttion = selecttion;
    }

    @Override
    public int getSize() {
        return lSec.size();
    }

    @Override
    public Object getElementAt(int index) {
        return lSec.get(index).getSectname();
    }

    @Override
    public void setSelectedItem(Object anItem) {
        selecttion =  anItem;
    }

    @Override
    public Object getSelectedItem() {
       return selecttion;
    }
    
    
}
